





#pragma once

#include "NODBCSessionObject.h"

class NODBCSessionHandler
{
	public:
		bool isOK( void ) const;
		SQLRETURN ExecDirect( const string in_strQuery );
		SQLRETURN UnBind( void );
		SQLRETURN BindCol(
					SQLUSMALLINT ColumnNumber, 
					SQLSMALLINT  TargetType, 
					SQLPOINTER   TargetValue, 
					SQLINTEGER   BufferLength, 
					SQLINTEGER*  StrLen_or_Ind);

		SQLRETURN BindParameter(    
					SQLUSMALLINT	ipar,
					SQLSMALLINT     fParamType,
					SQLSMALLINT     fCType,
					SQLSMALLINT     fSqlType,
					SQLUINTEGER     cbColDef,
					SQLSMALLINT     ibScale,
					SQLPOINTER      rgbValue,
					SQLINTEGER      cbValueMax,
					SQLINTEGER*		pcbValue);

		SQLRETURN GetData(
					SQLUSMALLINT	ColumnNumber, 
					SQLSMALLINT		TargetType,
					SQLPOINTER		TargetValue, 
					SQLINTEGER		BufferLength,
					SQLINTEGER*		StrLen_or_Ind);

		SQLRETURN CloseCursor( void );
		SQLRETURN PutData( SQLPOINTER Data, SQLINTEGER StrLen_or_Ind );
		SQLRETURN Fetch( void );
		SQLRETURN ParamData( SQLPOINTER* Value );

		void Disconnect( const char* in_pSourceFileName, const int in_SourceLineNum );
		operator SQLHSTMT() { return m_hStmt; };


		void OutputErrorString(
				const char*		    in_pSourceFileName,
				const int			in_SourceLineNum,
				const char*         in_pMessage = NULL);

	public:		
		NODBCSessionHandler( const string in_DatabaseName );
		virtual ~NODBCSessionHandler();

	private:
		bool				 m_bOK;
		NODBCSessionObject*  m_cpODBCSessionObject;
		SQLHSTMT			 m_hStmt;

};


